package com.work.vo.main;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.work.constant.DictBizConstant;
import com.work.utils.BigDecimalSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictBizCache;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 货物库存汇总统计-货场理货VO
 *
 * @author ：dujianyu
 * @since ：Created in 2024/7/8 10:59
 */
@Data
public class StorageByPositionTallyVO {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "tallyId",notes = "")
    private Long tallyId ;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "storageId",notes = "")
    private Long storageId ;

    @ApiModelProperty(value = "理货日期")
    private LocalDate tallyDate;

    @ApiModelProperty(value = "时间段")
    private String timeSpace;

    @ApiModelProperty(value = "时间段")
    private String timeSpaceName;

    public String getTimeSpaceName() {
        if (Func.isNull(timeSpace)) {
            return "";
        }
        return DictBizCache.getValue(DictBizConstant.TIME_SPACE, timeSpace);
    }

    @ApiModelProperty(value = "时间信息")
    private String timeInfo;

    public String getTimeInfo() {
        if (Func.isNull(timeSpace) || Func.isNull(tallyDate)) {
            return "";
        }
        return tallyDate + "/" + DictBizCache.getValue(DictBizConstant.TIME_SPACE, timeSpace);
    }

    @ApiModelProperty(value = "航陆运")
    private String shipLand;

    @ApiModelProperty(value = "航陆运")
    private String shipLandName;

    public String getShipLandName() {
        if (Func.isNull(shipLand)) {
            return "";
        }
        return DictBizCache.getValue(DictBizConstant.SHIP_LAND, shipLand);
    }

    @ApiModelProperty(value = "理货类型")
    private String tallyType;

    @ApiModelProperty(value = "理货类型")
    private String tallyTypeName;

    public String getTallyTypeName() {
        if (Func.isNull(tallyType)) {
            return "";
        }
        return DictBizCache.getValue(DictBizConstant.TALLY_TYPE, tallyType);
    }

    @ApiModelProperty(value = "理货件数")
    private Integer tallyPiece;

    @JsonSerialize(using = BigDecimalSerializer.class)
    @ApiModelProperty(value = "理货吨数")
    private BigDecimal tallyTon;

    @ApiModelProperty(value = "理货件吨")
    private String tallyPieceTonInfo;

    public String getTallyPieceTonInfo() {
        if (Func.isNull(tallyPiece) || Func.isNull(tallyTon)) {
            return "";
        }

        return tallyPiece + "/" + tallyTon.stripTrailingZeros().toPlainString();
    }

    @ApiModelProperty(value = "检算件数")
    private Integer checkPiece;

    @JsonSerialize(using = BigDecimalSerializer.class)
    @ApiModelProperty(value = "检算吨数")
    private BigDecimal checkTon;

    @ApiModelProperty(value = "检算件吨")
    private String checkPieceTonInfo;

    public String getCheckPieceTonInfo() {
        if (Func.isNull(checkPiece) || Func.isNull(checkTon)) {
            return "";
        }

        return checkPiece + "/" + checkTon.stripTrailingZeros().toPlainString();
    }

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "创建人",notes = "")
    private Long createUser ;

    @ApiModelProperty(value = "创建人")
    private String createUserName;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(name = "队组全名",notes = "")
    private String workerInfo ;

    @ApiModelProperty(name = "机械信息",notes = "")
    private String machineInfo ;

    @ApiModelProperty(name = "作业过程",notes = "")
    private Long operationType ;

    @ApiModelProperty(name = "作业过程",notes = "")
    private String operationTypeName ;

    @ApiModelProperty(name = "保管员",notes = "")
    private String keeperName ;

    @ApiModelProperty(value = "数据来源")
    private String dataFrom;

}
